home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 25
/
Aminet 25 (1998)(GTI - Schatztruhe)[!][Jun 1998].iso
/
Aminet
/
util
/
pack
/
xpk_Source.lha
/
xpk_Source
/
test
/
testFullPack.c
< prev
next >
Wrap
C/C++ Source or Header
|
1998-02-08
|
3KB
|
111 lines
#define NAME "testFullPack"
#define DISTRIBUTION "(Freeware) "
#define REVISION "2"
/* Programmheader
Name: testFullPack
Author: SDI
Distribution: Freeware
Description: tests all packmodes with all file-sizes to 100000
Compileropts: -
Linkeropts: -l xpkmaster amiga
1.0 15.05.97 : first version to find IDEA error
1.1 16.05.97 : changed output format (shorter)
1.2 17.05.97 : fixed a wrong parameter
*/
#include <proto/exec.h>
#include <proto/dos.h>
#include <proto/xpkmaster.h>
#include <exec/memory.h>
#include "SDI_defines.h"
struct Library *XpkBase = 0;
ULONG DosVersion = 37;
#define PARAM "METHOD,START/N,PASSWORD,FILE,STEP/N"
void main(void)
{
ULONG noth = 1, step = 1;
struct RDArgs *rda;
struct args
{
STRPTR method;
ULONG *start;
STRPTR password;
STRPTR file;
ULONG *step;
} args = {"IDEA", 0, "TestPwd", "testFullPack.out", 0};
args.start = ¬h;
args.step = &step;
if((rda = ReadArgs(PARAM, (LONG *) &args, 0)))
{
if((XpkBase = OpenLibrary(XPKNAME, 0)))
{
STRPTR ibuf;
if((ibuf = (STRPTR) AllocMem(100000, MEMF_CLEAR)))
{
STRPTR obuf;
if((obuf = (STRPTR) AllocMem(200000, MEMF_ANY)))
{
ULONG fh;
if((fh = Open(args.file, MODE_READWRITE)))
{
ULONG i, j, olen;
LONG err;
Seek(fh, 0, OFFSET_END);
for(i = 0; i < 100000; ++i)
ibuf[i] = i;
for(i = *args.start; !CTRL_C && i <= 100000; i += *args.step)
{
Printf("%6ld: ", i);
FPrintf(fh, "%6ld: ", i);
for(j = 0; !CTRL_C && j <= 100; ++j)
{
if((err = XpkPackTags(XPK_InBuf, ibuf, XPK_InLen, i,
XPK_PackMethod, args.method, XPK_OutBuf, obuf,
XPK_OutBufLen, 200000, XPK_GetOutLen, &olen, XPK_Password,
args.password, XPK_PackMode, j, TAG_DONE)))
{
Printf("p%03ld(%02ld), ", j, -err);
FPrintf(fh,"p%03ld(%02ld), ", j, -err);
}
else if((err = XpkUnpackTags(XPK_InBuf, obuf, XPK_InLen, olen,
XPK_OutName, "NIL:", XPK_Password, args.password, TAG_DONE)))
{
Printf("u%03ld(%02ld), ", j, -err);
FPrintf(fh,"u%03ld(%02ld), ", j, -err);
}
}
if(CTRL_C)
{
Printf("\nbreak: %03ld", j);
FPrintf(fh, "\nbreak: %03ld", j);
}
Printf("\n");
FPrintf(fh, "\n");
}
Close(fh);
}
FreeMem(obuf, 200000);
}
FreeMem(ibuf, 100000);
}
CloseLibrary(XpkBase);
}
FreeArgs(rda);
}
}